
package it.luigiarpino.sudoku;
import javax.swing.*;
import java.awt.*;

public class Editor extends JDialog {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel pannello;
    private JButton bottone1;
    private JButton bottone2;
    private JButton bottone3;
    private JButton bottone4;
    private JButton bottone5;
    private JButton bottone6;
    private JButton bottone7;
    private JButton bottone8;
    private JButton bottone9;
    private JButton bottoneCancel;
    public String valore;
    
    
    
    /** Creates a new instance of Editor */
    public Editor() {
        super();
        try 
    	{ 
      		javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName()); 
                
    	} 
    	catch(Exception e) {}
        pannello=new JPanel();
        this.pannello.setLayout(new GridLayout(4,3));
        this.bottone1 =new JButton("1");
        this.bottone2=new JButton("2");
        this.bottone3=new JButton("3");
        this.bottone4=new JButton("4");
        this.bottone5=new JButton("5");
        this.bottone6=new JButton("6");
        this.bottone7=new JButton("7");
        this.bottone8=new JButton("8");
        this.bottone9=new JButton("9");
        this.bottoneCancel=new JButton("C");
        this.bottoneCancel.setToolTipText("Cancel Button");
        Font carattere =new Font("SansSerif",Font.PLAIN,16);
        this.bottone1.setFont(carattere);
        this.bottone2.setFont(carattere);
        this.bottone3.setFont(carattere);
        this.bottone4.setFont(carattere);
        this.bottone5.setFont(carattere);
        this.bottone6.setFont(carattere);
        this.bottone7.setFont(carattere);
        this.bottone8.setFont(carattere);
        this.bottone9.setFont(carattere);
        this.bottoneCancel.setFont(carattere);
        
        // Imposta Azioni Bottoni
        this.bottone1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone1ActionPerformed(evt);
            }
        });
        this.bottone2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone2ActionPerformed(evt);
            }
        });
        this.bottone3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone3ActionPerformed(evt);
            }
        });
        this.bottone4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone4ActionPerformed(evt);
            }
        });
        this.bottone5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone5ActionPerformed(evt);
            }
        });
        this.bottone6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone6ActionPerformed(evt);
            }
        });
        this.bottone7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone7ActionPerformed(evt);
            }
        });
        this.bottone8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone8ActionPerformed(evt);
            }
        });
        this.bottone9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottone9ActionPerformed(evt);
            }
        });
        this.bottoneCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottoneCancelActionPerformed(evt);
            }
        });
        
        this.pannello.add(this.bottone1);
        this.pannello.add(this.bottone2);
        this.pannello.add(this.bottone3);
        this.pannello.add(this.bottone4);
        this.pannello.add(this.bottone5);
        this.pannello.add(this.bottone6);
        this.pannello.add(this.bottone7);
        this.pannello.add(this.bottone8);
        this.pannello.add(this.bottone9);
        this.pannello.add(this.bottoneCancel);
        this.getContentPane().setLayout(new BorderLayout());
        this.getContentPane().add(pannello, BorderLayout.CENTER);
        this.setSize(100,100);
        this.setLocationRelativeTo(null);
        this.setModal(true);
        this.pack();
        
    }
        public static void main(String args[]) {
        Editor ed =new Editor();
        ed.setVisible(true);
    }
    private void bottone1ActionPerformed(java.awt.event.ActionEvent evt){
        valore="1";
        this.setVisible(false);
    }
    private void bottone2ActionPerformed(java.awt.event.ActionEvent evt){
        valore="2";
        this.setVisible(false);
    }
    private void bottone3ActionPerformed(java.awt.event.ActionEvent evt){
        valore="3";
        this.setVisible(false);
    }
    private void bottone4ActionPerformed(java.awt.event.ActionEvent evt){
        valore="4";
        this.setVisible(false);
    }
    private void bottone5ActionPerformed(java.awt.event.ActionEvent evt){
        valore="5";
        this.setVisible(false);
    }
    private void bottone6ActionPerformed(java.awt.event.ActionEvent evt){
        valore="6";
        this.setVisible(false);
    }
    private void bottone7ActionPerformed(java.awt.event.ActionEvent evt){
        valore="7";
        this.setVisible(false);
    }
    private void bottone8ActionPerformed(java.awt.event.ActionEvent evt){
        valore="8";
        this.setVisible(false);
    }
    private void bottone9ActionPerformed(java.awt.event.ActionEvent evt){
        valore="9";
        this.setVisible(false);
    }
    private void bottoneCancelActionPerformed(java.awt.event.ActionEvent evt){
        valore=" ";
        this.setVisible(false);
    }
    
    
}
